package com.demo.server1.controller;

import com.demo.server1.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by hunter
 *
 * @Description 测试控制层
 */
@RestController
public class TestController {

    @Autowired
    private UserService userService;

    /**
     * 测试普通接口调用
     *
     * @return
     */
    @GetMapping("/test")
    public String test() {
        return userService.test();
    }

    /**
     * 测试分布式事务接口
     *
     * @return
     */
    @GetMapping("/testTransactional")
    public String testTransactional(@RequestParam(value = "name") String name) {
        userService.testTransactional(name);
        return "success";
    }
}
